home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / other / flexcat / contribution / flex_arexx next >
Text File  |  1999-06-14  |  1KB  |  61 lines

  1.  
  2. FlexCat source in ARexx programs
  3. ================================
  4.  
  5. Let's have a look at Arexx.sd, the source description for  localised  Arexx
  6. programs  {which  is  a  fully  functional  program  to  show the useage of
  7. localisation, so you have to replace everything between "INSERT  YOUR  CODE
  8. HERE" and "END OF YOUR CODE" with your own code.}
  9.  
  10.  
  11. /* Arexx.sd  ARexx locale support */
  12.  
  13. TRUE = 1 ; FALSE = 0
  14. locale = TRUE ; DEF_LOC = FALSE
  15.  
  16. IF ~Show('L',"locale.library") THEN
  17.    IF ~AddLib("locale.library",0,-30) THEN DO
  18.       SAY "No locale support"
  19.       locale = FALSE
  20.    END
  21.  
  22. CALL DefineLocaleStrings   /* set defaults */
  23.  
  24. cat = OpenCatalog("%b.catalog","%l",%v)  /* open catalog */
  25.  
  26. IF cat = 0 THEN
  27.    SAY "Error: Could not use localized strings. Using defaults instead."
  28.  
  29.  
  30. /* INSERT YOUR CODE HERE */
  31.  
  32.    /* Example: Print out all available catalog strings */
  33.    SAY "%d:" GetLocStr(%i)
  34.  
  35. /* END OF YOUR CODE */
  36.  
  37.  
  38.  
  39. CALL CloseCatalog(cat)
  40. EXIT
  41.  
  42. /* ############## Subroutines ############### */
  43.  
  44. GetLocStr:                             /* get a localized string */
  45.    ARG id .
  46.    locstr = GetCatalogStr(cat,id,defstr.id)
  47. RETURN locstr
  48.  
  49. DefineLocaleStrings:                   /* define default strings */
  50.    IF DEF_LOC = TRUE THEN RETURN
  51.  
  52.    /* identifiers */
  53.    %i = %d
  54.  
  55.    /* default strings */
  56.    defstr.%i = %s
  57.  
  58.    DEF_LOC = TRUE
  59.  
  60. RETURN
  61.